/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package erpretailx.Manager;

import erpretailx.Component.ControlPaneContainer;
import erpretailx.Component.StatusPanel;
import erpretailx.Component.StatusBar;
import erpretailx.Component.ToolBar;
import erpretailx.Component.WorkPanel;
import erpretailx.Component.WorkSpacePanel;
import erpretailx.MainWindow;
import erpretailx.inModul.ModulManager.ModulUI;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

/**
 *
 * @author Al Quthsi
 */
//singleton workspace
public class WorkSpace {
    private static WorkSpace singleton;

    //right workspace
    private JPanel rightWorkspace;
    private StatusBar statusBar;
    private ToolBar toolBar;
    private WorkPanel workPanel;

    //letf workspace
    private JPanel leftWorkSpace;
    private ControlPaneContainer controlContainer;
    private StatusPanel statusBox;
  

    private WorkSpace(){
        final MainWindow mainWindow = RetailManager.getMainWindow();

        //prepare left workspace
        leftWorkSpace = new JPanel();
        controlContainer = new ControlPaneContainer();
        statusBox = new StatusPanel();
        leftWorkSpace.setLayout(new BoxLayout(leftWorkSpace, BoxLayout.Y_AXIS));
        //add stausbox and controlcontainer to leftworkpace
        leftWorkSpace.add(statusBox);
        leftWorkSpace.add(controlContainer);

        //prepare right workspace
        rightWorkspace = new JPanel();
        rightWorkspace.setLayout(new BoxLayout(rightWorkspace, BoxLayout.Y_AXIS));
        statusBar = new StatusBar();
        toolBar = new ToolBar();
        workPanel = new WorkPanel();
        //add to rightworkspace
        rightWorkspace.add(toolBar);
        rightWorkspace.add(workPanel);
        rightWorkspace.add(statusBar);

        JSplitPane splitPane= new JSplitPane();
        splitPane = RetailManager.getMainWindow().getSplitPane();
        splitPane.add(rightWorkspace, JSplitPane.RIGHT);
        splitPane.add(leftWorkSpace,JSplitPane.LEFT);


        //
 
 

    }

    public static WorkSpace getInstance(){
        if(singleton == null){
            WorkSpace controller = new WorkSpace();
            singleton = new WorkSpace();
            return singleton;
        }
        return singleton;
    }

    public ControlPaneContainer getControlContainer() {
        return controlContainer;
    }




}
